// (function (win) {
//     console.log("test.js win:",win);
// })(window);

function execute(){
    console.log("test.js -- execute()");

    //
    const item = {
        name:"zxs",
        age:41,
        description:"描述信息"
    }

    // 获取对象的所有的键
    console.log(Object.keys(item));

    let s = "afxmsg";
    // 负数为从
    s = s.slice(0,-1);
    console.log(s);


    // 提取对象中的一个属性(这边括号中为属性名称)
    const {name} = item;
    console.log("name:",name);


    const {name2} = item;
    console.log("name2:",name2);

    // 这边
    const {age,description,tt} = item;
    console.log("age:",age,",description:",description,",tt:",tt);

    const ss = "if i do a mind,i will think";
    // 字符串中是否包含对应的
    console.log(ss.includes("do a mind"));
    console.log(ss.includes("do  a mind"));

    let msg = " Network Error ";
    if (msg == "Network Error") {
        msg = "后端接口连接异常";
    }
    console.log(msg);

    //
    let ass = /^1(3|4|5|6|7|8)\d{9}$/;
    console.log(typeof ass);

    // 判断某对象是否为 正则
    const isRegex = ass instanceof RegExp;
    console.log("isRegex:",isRegex);

    console.log("(typeof RegExp):",typeof RegExp);

}


// 如果定义相同名称的函数，后定义的会覆盖前面的
function execute(){
    console.log("test.js -- execute() --2");
    let as = "ss"
    function f1(as){
        f2(as);
    }

    function f2(ar){
        let t = {
            data:{
                ...ar
            }
        }
        console.log(t);
    }

    f1(as);
}

(function () {
    console.log("test.js -- 这边是匿名函数");
    execute();
})();


// 代码块2
{
    console.log("t2.js -- 代码块2 ");
    function t2() {
        console.log("t2()");

        const status = "enable";
        const id = 22;

        const params = {
            status,
            id
        }

        console.log(JSON.stringify(params));
    }
    t2();
}


// 代码块3
{
    console.log("test.js -- 代码块3 ");
    function t3() {
        console.log("t3()");

        class MyClass {
            constructor(){
                console.log("MyClass 对象的构造方法");
            }

            showMessage() {
                console.log("showMessage()");

                function g() {
                    console.log("g()-1");
                }

                g();
            }

            f() {
                console.log("f()");
            }

            g() {
                console.log("g()");
            }
        }

        const myClass = new MyClass();
        myClass.showMessage();

    }
    t3();
}

